package com.one.blocks.common.valid.constraints;

import com.one.blocks.common.valid.validator.EnumContainsValid;
import com.one.blocks.common.valid.validator.EnumContainsValidatorForInteger;
import com.one.blocks.common.valid.validator.EnumContainsValidatorForLong;
import com.one.blocks.common.valid.validator.EnumContainsValidatorForString;

import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * @author <a href="mailto:idler41@163.com">linfuxin</a> created by 2022-12-11 09:59:39
 */
@Target({ElementType.FIELD, ElementType.PARAMETER, ElementType.TYPE_USE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Constraint(validatedBy = {EnumContainsValidatorForInteger.class, EnumContainsValidatorForLong.class, EnumContainsValidatorForString.class})
public @interface EnumContains {

    Class<? extends Enum<? extends EnumContainsValid<?>>> value();

    String message() default "数据非法";

    Class<?>[] groups() default {};

    Class<? extends Payload>[] payload() default {};
}
